Parse vcpus for VMX guest.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 21 Sep 2005 09:58:15 +0000 (09:58 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 21 Sep 2005 09:58:15 +0000 (09:58 +0000)
Vcpus are passed to device model and vmx domain builder.

Signed-off-by: Yan Li <yanx.li@intel.com>
Signed-off-by: Xin Li <xin.b.li@intel.com>
tools/examples/xmexample.vmx
tools/ioemu/vl.c
tools/libxc/xc_vmx_build.c
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 28f34462fdcb0dcd47fcf63f20566a3addcd4e62..c797e6e05907097edb69c99155291090bfc754a5 100644 (file)
@@ -26,6 +26,10 @@ memory = 128
 # A name for your domain. All domains must have different names.
 name = "ExampleVMXDomain"
 
+#-----------------------------------------------------------------------------
+# the number of cpus guest platform has, default=1
+vcpus=1
+
 # Which CPU to start domain on? 
 #cpu = -1   # leave to Xen to pick
 
index d5d00d22d804c0af44d9e7d597f0b7c55566c75f..426205bc27ed0719f85d2cd33eada529fcb0d093 100644 (file)
@@ -126,6 +126,7 @@ QEMUTimer *polling_timer;
 int vm_running;
 int audio_enabled = 0;
 int nic_pcnet = 1;
+int vcpus = 1;
 int sb16_enabled = 1;
 int adlib_enabled = 1;
 int gus_enabled = 1;
@@ -2105,6 +2106,7 @@ void help(void)
           "-snapshot       write to temporary files instead of disk image files\n"
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
            "-nographic      disable graphical output and redirect serial I/Os to console\n"
+           "-vcpus          set CPU number of guest platform\n"
 #ifdef CONFIG_VNC
           "-vnc port             use vnc instead of sdl\n"
           "-vncport port         use a different port\n"
@@ -2235,6 +2237,7 @@ enum {
     QEMU_OPTION_hdachs,
     QEMU_OPTION_L,
     QEMU_OPTION_no_code_copy,
+    QEMU_OPTION_vcpus,
     QEMU_OPTION_pci,
     QEMU_OPTION_nic_pcnet,
     QEMU_OPTION_isa,
@@ -2307,6 +2310,7 @@ const QEMUOption qemu_options[] = {
     { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
     { "L", HAS_ARG, QEMU_OPTION_L },
     { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
+    { "vcpus", 1, QEMU_OPTION_vcpus },
 #ifdef TARGET_PPC
     { "prep", 0, QEMU_OPTION_prep },
     { "g", 1, QEMU_OPTION_g },
@@ -2646,6 +2650,9 @@ int main(int argc, char **argv)
             case QEMU_OPTION_S:
                 start_emulation = 0;
                 break;
+            case QEMU_OPTION_vcpus:
+                vcpus = atoi(optarg);
+                fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus);
             case QEMU_OPTION_pci:
                 pci_enabled = 1;
                 break;
index 50284d9c3f4735bfcc742e6d1fa39b5933196756..96f98528be9200b5399ff23eda0691d411078e28 100644 (file)
@@ -626,6 +626,10 @@ static int setup_guest(int xc_handle,
     /* Mask all upcalls... */
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
         shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+
+    shared_info->n_vcpu = vcpus;
+    printf(" VCPUS:         %d\n", shared_info->n_vcpu);
+
     munmap(shared_info, PAGE_SIZE);
 
     /* Populate the event channel port in the shared page */
index e4837e27cdcc8a2b6f105b2b70bfeebc8d58bd77..30b94cd13125c783c03030b62787a3b889c3947b 100644 (file)
@@ -336,7 +336,7 @@ class VmxImageHandler(ImageHandler):
     # xm config file
     def parseDeviceModelArgs(self, config):
         dmargs = [ 'cdrom', 'boot', 'fda', 'fdb',
-                   'localtime', 'serial', 'stdvga', 'isa' ] 
+                   'localtime', 'serial', 'stdvga', 'isa', 'vcpus' ] 
         ret = []
         for a in dmargs:
             v = sxp.child_value(config, a)
index 50f4cc2642dbc4bf2a98a197c14271cca6274774..a5998900534f6e67ba3cfc963779626ce68774a9 100644 (file)
@@ -496,7 +496,7 @@ def configure_vfr(opts, config, vals):
 def configure_vmx(opts, config_image, vals):
     """Create the config for VMX devices.
     """
-    args = [ 'memmap', 'device_model', 'cdrom',
+    args = [ 'memmap', 'device_model', 'vcpus', 'cdrom',
              'boot', 'fda', 'fdb', 'localtime', 'serial', 'macaddr', 'stdvga', 
              'isa', 'nographic', 'vnc', 'vncviewer', 'sdl', 'display']
     for a in args: